package notes.designpattern.java.d1_danyiyuanze;

/**
 * 单一职责原则
 */
public class Danyiyuanze3 {

	public static void main(String[] args) {
		Vehicle2 v = new Vehicle2();
		v.run("摩托车");
		v.run("汽车");
		
		v.runPlay("飞机");
		v.runWater("轮船");
	}
}

// 交通工具类
class Vehicle2 {
	public void run(String name) {
		System.out.println(name + "->在路上运行");
	}
	
	public void runPlay(String name) {
		System.out.println(name + "->在空中运行");
	}
	
	public void runWater(String name) {
		System.out.println(name + "->在水中运行");
	}
}

